package ltd.dujiabao.cmsservice.config;

import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * @author : DuJiabao
 * @Project : online-course-project
 * @Time : 2021/4/18 20:03
 * @Desc :
 */
@Configuration
@MapperScan("ltd.dujiabao.cmsservice.mapper") // 指定mapper扫描路径
@ComponentScan(basePackages={"ltd.dujiabao"})  // 设置扫描路径，可以扫描包括导入的包
@EnableDiscoveryClient  // 服务注册
@EnableFeignClients // 允许HTTP客户端运行
public class EduConfig {
  /**
   * 逻辑删除插件
   */
  @Bean
  public ISqlInjector sqlInjector() {
    return new LogicSqlInjector();
  }

  @Bean
  public PaginationInterceptor paginationInterceptor() {
    return new PaginationInterceptor();
  }

}
